home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / lib / tclX-6.4 / help / intro / braces < prev    next >
Encoding:
Text File  |  1992-12-17  |  1.9 KB  |  39 lines

  1.      GROUPING ARGUMENTS WITH BRACES
  2.           Curly braces may also be used for grouping arguments.   They
  3.           are  similar  to  quotes except for two differences.  First,
  4.           they nest; this makes them easier  to  use  for  complicated
  5.           arguments  like  nested  Tcl  command  strings.  Second, the
  6.           substitutions described below for commands,  variables,  and
  7.           backslashes do not occur in arguments enclosed in braces, so
  8.           braces can be used to prevent substitutions where  they  are
  9.           undesirable.  If an argument field begins with a left brace,
  10.           then the argument ends at the  matching  right  brace.   Tcl
  11.           will  strip  off  the outermost layer of braces and pass the
  12.           information between the braces to the  command  without  any
  13.           further modification.  For example, in the command
  14.  
  15.                set a {xyz a {b c d}}
  16.           the set command will receive two arguments: a and xyz a {b c
  17.           d}.
  18.  
  19.           When braces or quotes are in effect, the matching  brace  or
  20.           quote  need not be on the same line as the starting quote or
  21.           brace; in this case the newline  will  be  included  in  the
  22.           argument  field  along  with  any other characters up to the
  23.           matching brace or quote.   For  example,  the  eval  command
  24.           takes  one argument, which is a command string; eval invokes
  25.           the Tcl interpreter to  execute  the  command  string.   The
  26.           command
  27.  
  28.                eval {
  29.                     set a 22
  30.                     set b 33
  31.                }
  32.  
  33.           will assign the value 22 to a and 33 to b.
  34.  
  35.           If the first character of a command  field  is  not  a  left
  36.           brace,  then neither left nor right braces in the field will
  37.           be  treated  specially   (except   as   part   of   variable
  38.           substitution; see below).
  39.